package exemplos.exemplo01;

import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

@ManagedBean(name="converter")
@RequestScoped
public class ConverterMB {
	private double ieneVal = 0;
	private double dolarVal = 0;
	private double euroVal = 0;
	
	@EJB
	private ConverterBean converterEJB;
	
	public ConverterMB() {
		super();
	}

	public double getIeneVal() {
		return ieneVal;
	}

	public void setIeneVal(double ieneVal) {
		this.ieneVal = ieneVal;
	}

	public double getDolarVal() {
		return dolarVal;
	}

	public void setDolarVal(double dolarVal) {
		this.dolarVal = dolarVal;
	}

	public double getEuroVal() {
		return euroVal;
	}

	public void setEuroVal(double euroVal) {
		this.euroVal = euroVal;
	}
	
	public String converteIeneToDolar() {
		this.dolarVal = converterEJB.ieneToDolar(ieneVal);
		return "resultadoDolar.jsp";
	}
	public String converteEuroToIene() {
		this.ieneVal = converterEJB.euroToIene(euroVal);
		return "resultadoIene.jsp";
	}
}
